"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const config_1 = require("../../config");
Page({
    data: {
        ticketText: '',
        customerWechat: config_1.CUSTOMER_SERVICE_WECHAT,
        adUnitId: config_1.AD_UNIT_ID_HOME,
        adError: false,
        allowDecimal: config_1.DEFAULT_ALLOW_DECIMAL,
    },
    onTicketInput(e) {
        this.setData({ ticketText: e.detail.value });
    },
    onProcess() {
        const text = this.data.ticketText.trim();
        if (!text) {
            wx.showToast({ title: '请先输入票务信息', icon: 'none' });
            return;
        }
        wx.navigateTo({
            url: '/pages/result/result',
            success: (res) => {
                res.eventChannel.emit('loadData', {
                    rawText: this.data.ticketText,
                    allowDecimal: this.data.allowDecimal,
                });
            },
        });
    },
    onClear() {
        this.setData({ ticketText: '' });
    },
    onCopyWechat() {
        const { customerWechat } = this.data;
        if (!customerWechat) {
            wx.showToast({ title: '暂未配置客服微信号', icon: 'none' });
            return;
        }
        wx.setClipboardData({ data: customerWechat });
    },
    onAdError() {
        this.setData({ adError: true });
    },
});
